Hi SJH,
KFLOP has a Bootloader Program that boots first that is capable of
communicating with the PC. It also flashes the LED's for ~3sec
waiting for a special command from the PC (ESC B). If received it
remains in the bootloader and can accept a Firmware download from
the PC to memory (not Flash). The Bootloader responds with a byte
of 0x03. After downloading the firmware the PC then sends a command
to tell the bootloader to jump to some address (0x0000000C) to
startup the main firmware.
The code below is used to do this from a Windows worker Thread. In
parallel the GUI in the Config Flash Dialog displays a wait dialog
box. The KMotionLockRecovery() basically connects to KFLOP when it
becomes available without sending any special commands.
HTH
Regards
TK
DWORD RecoveryShell(LPDWORD lpdwParam)
{
int result;
CString response;
CString *s = (CString *)lpdwParam;
do
{
result = TheFrame->KMotionDLL->KMotionLockRecovery();
}
while (result != KMOTION_LOCKED &&
!TheFrame->ConfigDlg.TerminateRecovery);
if (TheFrame->ConfigDlg.TerminateRecovery) return 1;
TheFrame->KMotionDLL->ReleaseToken();
TheFrame->ConfigDlg.WaitDlg.Terminate=true; // we are
connected terminate wait dialog
if (TheFrame->KMotionDLL->WriteLineWithEcho("\x1b""B"))
return 1; // WithEcho doesn't prepend anything
if
(TheFrame->KMotionDLL->ReadLineTimeOut(response.GetBuffer(MAX_LINE),5000))
return 1;
response.ReleaseBuffer();
if (response != "\x03\r\n") return 1;
if (TheFrame->KMotionDLL->LoadCoff(-1, *s, 2)) return 1;
if (TheFrame->m_KFLOP)
{
if (TheFrame->KMotionDLL->WriteLine("JUMP 10000010"))
return 1; // App entry point hex 0x10000010
}
else
{
if (TheFrame->KMotionDLL->WriteLine("JUMP C")) return
1; // App entry point hex 0xC
}
return 0;
}
Hi Tom,
I programmed a bad supervisor thread into the kflop
(broke my own rule about testing before flashing), and
it won't boot/power up properly, so I need to
reset/recover the firmware. I can hopefully do this
with the KMotion utility, but I would like to
integrate this with our Linux app. So how does the
recovery work? Is there a magic command that prevents
it from running any threads at the start?
Regards,
SJH